#ifndef DPM_CONFIG_H
#define DPM_CONFIG_H

#include <QObject>

class DPM_Config : public QObject
{
    Q_OBJECT

    Q_PROPERTY(QString group READ getGroup WRITE setGroup NOTIFY valuechang )
    Q_PROPERTY(QString appid READ getID WRITE setID NOTIFY valuechang )
    Q_PROPERTY(QString item READ getItem WRITE setItem NOTIFY valuechang )
    Q_PROPERTY(QString title READ getTilte WRITE setTitle NOTIFY valuechang )
    Q_PROPERTY(QString dir READ getDir WRITE setDir NOTIFY valuechang )
    Q_PROPERTY(QString batdir READ getBatDir WRITE setBatDir NOTIFY valuechang )
    Q_PROPERTY(QString ip READ getIP WRITE setIP NOTIFY valuechang )
    Q_PROPERTY(int port READ getPort WRITE setPort NOTIFY valuechang )
    Q_PROPERTY(int relink READ getReLink WRITE setReLink NOTIFY valuechang )



public:
    explicit DPM_Config(QObject *parent = nullptr);

    //同所在空间大厅
    QString lobby;
    //同步房间
    QString room;
    //用户连接用户名
    QString user;
    QString password;

    //组同组传输
    QString group="group1";
    void  setGroup(QString g){group=g;}
    QString  getGroup(){return group;}

    //应用id
    QString appid="id001";
    void  setID(QString g){appid=g;}
    QString  getID(){return appid;}

    //项目
    QString item="水分";
    void  setItem(QString g){item=g;}
    QString  getItem(){return item;}
    //标题
    QString title="water";
    void  setTitle(QString g){title=g;}
    QString  getTilte(){return title;}

    //监控目录
    QString dir="C:/datasave";
    void  setDir(QString g){dir=g;}
    QString  getDir(){return dir;}

    //备份目录
    QString batDir="C:/datsave";
    void  setBatDir(QString g){batDir=g;}
    QString  getBatDir(){return batDir;}
    //服务地址
    QString serverip="172.0.0.1";
    void  setIP(QString g){serverip=g;}
    QString  getIP(){return serverip;}
    //服务端口
    int serverport=6606;
    void  setPort(int g){serverport=g;}
    int  getPort(){return serverport;}
    //重连时间
    int relink=30000;
    void  setReLink(int g){relink=g;}
    int  getReLink(){return relink;}




signals:
  void valuechang();


public slots:

    void readConfig();
    void writeConfig();
    void save();

};

#endif // DPM_CONFIG_H
